﻿using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAL;

namespace BUS
{
    public class HinhAnhBUS
    {
        public static void INSERT(HinhAnh D)
        {
            HinhAnhDAL DAL = new HinhAnhDAL();
            DAL.INSERT(D);
        }
        public static void UPDATE(HinhAnh D)
        {
            HinhAnhDAL DAL = new HinhAnhDAL();
            DAL.UPDATE(D);
        }
        public static void DELETE(int iD)
        {
            HinhAnhDAL DAL = new HinhAnhDAL();
            DAL.DELETE(iD);
        }
        public static HinhAnhCollection GETALL()
        {
            HinhAnhDAL DAL = new HinhAnhDAL();


            int TotalRecords = 0;
            return DAL.GET("where 1=1", 0, 0,
                            HinhAnhColumn.MaHinh.ToString(),
                            "ASC", out TotalRecords);
        }
        public static HinhAnhCollection GET(string Where, int PageIndex, int PageSize, string OrderBy, string OrderDirection, out int TotalRecords)
        {
            HinhAnhDAL DAL = new HinhAnhDAL();
            return DAL.GET(Where, PageIndex, PageSize, OrderBy, OrderDirection, out TotalRecords);
        }
        public static HinhAnhCollection GetById(int iD)
        {
            int total = 0;
            HinhAnhDAL DAL = new HinhAnhDAL();
            return DAL.GET("where " + HinhAnhColumn.MaHinh.ToString() + "='" + iD + "'", 0, 0, HinhAnhColumn.MaHinh.ToString(), "ASC", out total);
            
        }
        public static HinhAnhCollection GetByIdSP(int iD)
        {
            int total = 0;
            HinhAnhDAL DAL = new HinhAnhDAL();
            return DAL.GET("where " + HinhAnhColumn.MaSanPham.ToString() + "='" + iD + "'", 0, 0, HinhAnhColumn.MaHinh.ToString(), "ASC", out total);

        }
    }
}
